import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http'; // HttpClient模块

import { AppComponent } from './app.component';
import { MenusComponent }  from './menus/menus.component';

// 添加内存假数据两个
import { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';
import { InMemoryDataService }  from './in-memory-data.service';

// 添加Service注入
import { MenuService }     from './menu.service';
// 添加Service注入
import { MessageService }       from './message.service';
import { MessagesComponent }    from './messages/messages.component';


@NgModule({
  imports: [
    BrowserModule,
    FormsModule,
    HttpClientModule,  // 添加HttpClient模块
    // 添加HTTP请求
    HttpClientInMemoryWebApiModule.forRoot(
      InMemoryDataService, { dataEncapsulation: false }
    )
  ],
  declarations: [
    AppComponent,     // 本地app组件
    MenusComponent,   // 添加menus组件
    MessagesComponent // 添加msg组件
  ],
  providers: [ 
    MenuService,      // 添加menu注入
    MessageService
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
